var baseURL = "http://localhost:9000"
function http({
    url,
    data,
    method
}) {
    console.log(baseURL + url);
    //显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
    wx.showLoading({
        title: '加载中...',
    })
    return new Promise((resolve, reject) => {
        wx.request({
            url: baseURL + url,
            data,
            header: { 'content-type': 'application/json' },
            method,
            dataType: 'json',
            responseType: 'text',
            success: (res) => {
                wx.hideLoading();
                resolve(res)
            }
        })
    })

}
module.exports = http;